<?php 
/**
 * @version			$Id: default_form.php 6 2010-07-22 10:04:21Z lowcosta@gmail.com $
 * @author			Richard Asp
 * @package			Joomla
 * @subpackage		gnudoor
 * @copyright		(C) 2010 gnudoor LLC
 * @license      GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

defined( '_JEXEC' ) or die( 'Restricted access' );
JHTML::_('script', 'form.js', 'components/com_gnudoor/assets/js/');
JHTML::_('script', 'datetimepicker_css.js', 'components/com_gnudoor/assets/js/');
JHTML::_('stylesheet', 'newform2.css','components/com_gnudoor/assets/css/');
// JHTML::_('stylesheet', 'rfnet.css','components/com_gnudoor/assets/css/');
$calgif = JHTML::image('components/com_gnudoor/assets/img/cal.gif','');
JHTMLBehavior::formvalidation();
// require_once (JPATH_COMPONENT_SITE.DS.'libs'.DS.'rand.php');
?>
	<div id="stylized" class="myform">
<script language="javascript">
function myValidate(f) {
   if (document.formvalidator.isValid(f)) {
      f.check.value='<?php echo JUtility::getToken(); ?>'; //send token
      return true; 
   }
   else {
      var msg = 'Some values are not acceptable.  Please retry.';
      alert(msg);
    }
   
   return false;
}
</script>
	
	
		<form id="form" name="helpForm" class="form-validate"  method="post" action="index.php" onSubmit="return myValidate(this);">
<fieldset>
	   <legend><?php if ($this->row->id == 0) { echo 'Add '; } else {echo 'Edit ';} ?><?php echo $this->titles[formHeader]; ?>
		</legend>

		<label for="name"><?php echo $this->titles[formName]; ?> 
		<span class="small" >Required</span></label>
			<input id="name" name="name" class="required" type="text" maxlength="255" value="<?php echo $this->row->name; ?>" />

		<label for="description"><?php echo $this->titles[formDescription]; ?> 
		<span class="small" >Enter your description</span></label>
			<textarea id="description" name="description" rows="10" ><?php echo $this->row->description; ?></textarea>

		<label for="value"><?php echo $this->titles[formValue]; ?>
		<span class="small" >Enter your project value</span></label>
			<input id="value" name="value" class="validate-numeric" size="10" value="<?php echo number_format($this->row->value, 2,'.','' ); ?>" type="text" />

		<label for="dateDue"><?php echo $this->titles[formDueDate]; ?> <a href="javascript:NewCssCal('dateDue','YYYYmmdd','dropdown',true,12,true)"><?php echo $calgif; ?></a> 
		<span class="small" >Click to change date/time</span></label>		  
			<input id="dateDue" name="dateDue" class="element text medium" size="25" value="
			<?php 
			if ($this->row->dateDue == 0) {
				echo 'Click here to set date';
			} else {
				echo $this->row->dateDue;
			}
			?>
			" type="text" />   

		<label for="email"><?php echo $this->titles[formEmail]; ?>
		<span class="small" >Enter your email address</span></label>
			<input id="email" name="email" class="validate-email" type="text" maxlength="255" value="<?php echo $this->row->email; ?>"/>

	<fieldset>
		<legend>Occupation:</legend>
<ol><li>
		<input id="occupation1" name="occupation1"
				class="checkbox" type="checkbox" value="1" />
		<label for="occupation1">Doctor</label>
</li><li>		
			<input id="occupation2" name="occupation2"
				class="checkbox" type="checkbox" value="1" />
		<label for="occupation2">Lawyer</label>
</li><li>		
			<input id="occupation3" name="occupation3"element
				class="checkbox" type="checkbox" value="1" />
		<label for="occupation3">Teacher</label>
</li><li>		
			<input id="occupation4" name="occupation4"
				class="checkbox" type="checkbox" value="1" />
		<label for="occupation4">Web designer</label>
</li></ol>	
	</fieldset>
		
<input type="hidden" name="option" value="com_gnudoor" />
<input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />
<input type="hidden" name="userid" value="<?php echo $this->row->userid; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="gnudoor" />
<?php if ($this->row->id == 0) { ?>
<input type="hidden" name="dateAdded" value="<?php echo date("Y-m-d H:i:s"); ?>" />
<input type="hidden" name="code" value="<?php echo GnudoorHelper::rand(); ?>" />
<?php } ?>
<fieldset>		
<div class="spacer"></div>
<button id="saveForm" class="submitbutton" onclick="javascript: submithelpbutton('save')" type="submit" name="submit" value="Submit">Submit</button>
<button id="cancelForm" class="submitbutton" onclick="javascript: submithelpbutton('cancel')" type="submit" name="cancel" value="Cancel" >Cancel</button>
</fieldset>
</form>        
                
	</div>
